/*
 * Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Sun designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Sun in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 * CA 95054 USA or visit www.sun.com if you need additional information or
 * have any questions.
 */

package jsr203.nio.file;

/**
 * A reference to a file that is an entry in a directory. Directory entries are
 * returned as the elements of a {@link DirectoryStream}'s iterator. A directory
 * entry encapsulates the {@link #getName name} of the file in the directory.
 *
 * <p> <b>Usage Example:</b>
 * Suppose we require to print the size and name of the files in a directory:
 * <pre>
 *     DirectoryStream stream = ...
 *     for (DirectoryEntry entry: stream) {
 *         long size = Attributes.readBasicFileAttributes(entry, false).size();
 *         System.out.format("%10d %s%n", size, entry.getName());
 *     }
 * </pre>
 *
 * @since 1.7
 */

public interface DirectoryEntry extends FileRef {
    /**
     * Returns the name of the file in the directory. The returned {@code Path}
     * has a single name component, representing the name of the file.
     *
     * <p> The {@link Path#resolve(DirectoryEntry) resolve} method may be used
     * to resolve the name against the path of a directory to construct a
     * {@code Path} to access the entry in the directory by {@code Path}.
     *
     * @return  The name of the file in the directory.
     */
    Path getName();
}
